package code.google.gui.adapter.util;

import java.util.Locale;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.support.v4.app.Fragment;
import code.google.gui.fragments.DummyFragment;

import com.example.metamusicgui.R;

public class FilesContext extends MenuContext {
	
	private Fragment albums;
	private Fragment artists;
	private Fragment songs;
	private int itemIDAlbum;
	private int itemIDArtist;
	private int itemIDSong;
	

	public FilesContext(Context context) {
		super(context);
		
		albums = new DummyFragment();
		artists = new DummyFragment();
		songs = new DummyFragment();
		
		itemIDAlbum = getItemID();
		itemIDArtist = getItemID();
		itemIDSong = getItemID();		
		
		setDummyData(albums, "ALBUMS");
		setDummyData(artists, "ARTISTS");
		setDummyData(songs, "SONGS");
	}

	@Override
	public Fragment getItemHook(int position) {
		switch (position) {
		case 1:
			return albums;
		case 2:
			return artists;
		case 3:
			return songs;
		default:
			return null;
		}
	}

	@Override
	public int getCountHook() {
		return 3;
	}

	@Override
	public CharSequence getPageTitleHook(int position) {
		Locale l = Locale.getDefault();
		Resources res = context.getResources();
		switch (position) {
		case 1:
			return res.getString(R.string.title_album).toUpperCase(l);
		case 2:
			return res.getString(R.string.title_artist).toUpperCase(l);
		case 3:
			return res.getString(R.string.title_song).toUpperCase(l);
		}
		return null;
	}

	@Override
	public long getItemIDHook(int position) {
		switch (position) {
		case 1:
			return itemIDAlbum;
		case 2:
			return itemIDArtist;
		case 3:
			return itemIDSong;
		}
		return -1;
	}

	@Override
	protected void onRegistrateFragmentsHook(Activity context) {
		// Nothing to do, cuse not implemented yet
	}

	@Override
	protected void onDeregistrateFragmentsHook(Activity context2) {
		// TODO Auto-generated method stub
		
	}

}
